namespace Pp.UI.Models
{
    using System;
    using System.Linq.Expressions;
    using System.Web.Mvc;

    public static class UrlHelpers
    {
        #region Action
        public static string Action<T>(this UrlHelper helper, Expression<Action<T>> action) where T : Controller
        {
            return helper.Action(action, null);
        }

        public static string Action<T>(this UrlHelper helper, Expression<Action<T>> action, object routeValues) where T : Controller
        {
            var actionInfo = Pp.UI.Models.ExpressionHelper.GetActionInfo(action);

            return helper.Action(actionInfo.ActionName, actionInfo.ControllerName, routeValues);
        }
        #endregion
    }
}